﻿using System;
using System.Windows.Forms;

namespace Masterduner.SourceStudio.Practices.DevelopmentLibrary.Utilities.DataConfiguration.Windows
{
    public partial class ProtectionOptionsWindow : Form
    {
        private int _protectionProvider;
        private string _selectedText;

        #region ProtectionProvider
        public int ProtectionProvider
        {
            get { return _protectionProvider; }
            protected set { _protectionProvider = value; }
        }
        #endregion

        #region SelectedText
        public string SelectedText
        {
            get { return _selectedText; }
            set { _selectedText = value; }
        }
        #endregion

        public ProtectionOptionsWindow()
        {
            InitializeComponent();
            this.label1.Tag = 1;
            this.label2.Tag = 2;
            this.label3.Tag = 3;
        }

        #region Close
        private void Close(int protection, string selectedText)
        {
            this.ProtectionProvider = protection;
            this.SelectedText = selectedText;
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        #endregion

        #region label1_Click
        private void label1_Click(object sender, EventArgs e)
        {
            this.Close(this.label1.Tag.ForceTo<int>(), this.label1.Text);
        }
        #endregion

        #region label2_Click
        private void label2_Click(object sender, EventArgs e)
        {
            this.Close(this.label2.Tag.ForceTo<int>(), this.label2.Text);
        }
        #endregion

        #region label3_Click
        private void label3_Click(object sender, EventArgs e)
        {
            this.Close(this.label3.Tag.ForceTo<int>(), this.label3.Text);
        }
        #endregion
    }
}
